package com.lab.network.model;

import com.cuitrip.apiservice.model.ApiManager;
import com.cuitrip.storage.prefrence.CachePreferenceInstance;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by ak on 15/11/10.
 */
public class CachePool {

    private static List<String> cacheMethodList = new ArrayList<>();


    static {
        cacheMethodList.add(ApiManager.SERVICE_SEARCH);
        cacheMethodList.add(ApiManager.RECOMMEND_CARD);
    }

    public static boolean needStore(String key){
        return cacheMethodList.contains(key);
    }

    public static void storeObject(String key, String object){
        CachePreferenceInstance.getInstance().write(key, object);
    }

    public static String getObject(String key){
        return CachePreferenceInstance.getInstance().read(key);
    }

    public static boolean hasObject(String key){
        return CachePreferenceInstance.getInstance().containsKey(key);
    }

}
